﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Sofire.DataComm.Net
{
    /// <summary>
    /// 表示一个缓冲包。
    /// </summary>
    public class BufferPackage
    {
        /// <summary>
        /// 获取字节的偏移量。
        /// </summary>
        public int Offset;
        /// <summary>
        /// 获取字节缓冲区。
        /// </summary>
        public byte[] Buffer;
        /// <summary>
        /// 获取缓冲区的长度。
        /// </summary>
        public int Length;

        /// <summary>
        /// 初始化一个 <see cref="Sofire.DataComm.Net.BufferPackage"/> 的新实例。
        /// </summary>
        /// <param name="buffer">字节缓冲区。</param>
        /// <param name="count">缓冲区长度。</param>
        public BufferPackage(byte[] buffer, int count) : this(buffer, 0, count) { }

        /// <summary>
        /// 初始化一个 <see cref="Sofire.DataComm.Net.BufferPackage"/> 的新实例。
        /// </summary>
        /// <param name="buffer">字节缓冲区。</param>
        /// <param name="offset">字节缓冲区。</param>
        /// <param name="count">缓冲区长度。</param>
        public BufferPackage(byte[] buffer, int offset, int count)
        {
            this.Buffer = buffer;
            this.Offset = offset;
            this.Length = count;
        }
    }
}
